//
// Created by Jisam on 2024/6/30.
//

#include<bits/stdc++.h>
using namespace std;
int l,r,mi,ans;
int s[5];
int a[21][5];
void search(int x,int y){
    if(x>s[y]){
        mi=min(mi,max(l,r));
        return;
    }
    l+=a[x][y];
    search(x+1,y);
    l-=a[x][y];

    r+=a[x][y];
    search(x+1,y);
    r-=a[x][y];
}
int main(){
    cin>>s[1]>>s[2]>>s[3]>>s[4];
    for(int i=1;i<=4;i++){
        l=r=0;
        mi=INT_MAX;
        for(int j=1;j<=s[i];j++)
            cin>>a[j][i];
        search(1,i);
        ans+=mi;
    }
    cout<<ans;
    return 0;
}